#include <string>

#define  EXPORTBUILD

#include "CPPSDK.hpp"
#include "TestCPP.hpp"



extern "C" _DLLExport void* CreateTestCPP()
{
    TestCPP* a = new TestCPP();
    return a;
}

extern "C" _DLLExport void ReleaseTestCPP(void* p)
{
    TestCPP* a = (TestCPP*)p;
    delete a;
}

extern "C" _DLLExport int GetTestCPP_A(void* p)
{
    TestCPP* a = (TestCPP*)p;
    return a->a;
}



extern "C" _DLLExport int TestInt(int a)
{
	return a;
}



extern "C" _DLLExport char* TestStringCopy(char* a)
{
	return strdup(a);
}

extern "C" _DLLExport void TestByteArrayCopy(char* data, int len, char** pOutData, int* pOutLen)
{
	*pOutData = (char*)malloc(len);
	memcpy(*pOutData, data, len);
	*pOutLen = len;
}

extern "C" _DLLExport void Free(void* p)
{
	free(p);
}

extern "C" _DLLExport void* TestObjectIntPtr(void* a)
{
	return a;
}

typedef void (*CallBackType)(const void * userData, int a, const char * msg, const void* arrPtr);
extern "C" _DLLExport void TestCallback(int a, const char * msg, const void* arrPtr, CallBackType callbackFunc, void* userData)
{
	callbackFunc(userData, a, msg, arrPtr);

	//char* tempMsg = strdup(msg);
    //callbackFunc(userData, a, tempMsg, arrPtr);
	//free(tempMsg);
}
